<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>{$lang.cp_home}</title>
<link rel="stylesheet" href="css/admincp.css" type="text/css" media="all" />
<script src="js/admin.js" type="text/javascript"></script>
</head>
<body>
<table id="frametable" cellpadding="0" cellspacing="0" width="100%" height="100%">
    <tr>
        <td colspan="2" height="67" valign="top">
                <div class="headermenu" id="topmenu">
                    <div class="logo"></div>
                    <div></div>
                    <div class="uinfo">
                        <a href="javascript:window.top.frames['main'].document.location.reload();window.top.frames['header-frame'].document.location.reload()">{$lang.refresh}</a>
                        <a href="index.php?act=clear_cache" target="main">{$lang.clear_cache}</a>
                    </div>
                    <ul>
                        <li><h3><a href="index.php?act=main" id="header_index" hidefocus="true" onClick="toggleMenu('index', 'index' ,0);doane(event);"><i class="iconfont">&#xe600;</i>{$lang.admin_home}</a></h3></li>
                        {foreach from=$menus item=menu key=k}
                        <li>
                            <h3><a href="javascript:;" id="header_{$k}" hidefocus="true" onClick="toggleMenu('{$k}', '{$k}' ,0);doane(event);"><i class="iconfont">{$menu.font}</i>{$menu.label}</a></h3>
                        </li>
						{/foreach}
                        <li><h3><a href="privilege.php?act=logout"><i class="iconfont">&#xe60e;</i>{$lang.signout}</a></h3></li>
                    </ul>
                </div>
        </td>
    </tr>
    <tr>
        <td valign="top" width="130" class="menutd">
		    <div id="leftmenu" class="menu">
                <ul id="menu_index" style="display:none">
                    <li><a href="index.php?act=main" hidefocus="true" target="main">{$lang.admin_home}</a></li>
                    <li><a href="privilege.php?act=modif" hidefocus="true" target="main">{$lang.set_navigator}</a></li>
					{foreach from=$nav_list item=item key=key}
					<li><a href="{$key}" hidefocus="true" target="main"><em onClick="menuNewwin(this)"></em>{$item}</a></li>
					{/foreach}
                </ul>
				{foreach from=$menus item=menu key=k}
				{if $menu.children}
                <ul id="menu_{$k}" style="display:none">
				    {foreach from=$menu.children item=child}
                    <li><a href="{$child.action}" hidefocus="true" target="main">{$child.label}</a></li>
					{/foreach}
                </ul>
				{/if}
				{/foreach}
            </div>
			</td>
        <td valign="top" width="100%"><iframe src="index.php?act=main" id="main" name="main" width="100%" height="100%" frameborder="0" scrolling="yes"></iframe></td>
    </tr>
</table>
<div class="copyright"><a href="index.php?act=about_us" target="main">(c) 资源爱好网源码</a></div>
<script type="text/JavaScript">
	var headers = new Array('index'{foreach from=$menus item=menu key=k},'{$k}'{/foreach});
	function switchheader(key) {
		if(!key || !$('header_' + key)) {
			return;
		}
		for(var k in top.headers) {
			if($('menu_' + headers[k])) {
				$('menu_' + headers[k]).style.display = headers[k] == key ? '' : 'none';
			}
		}
		var lis = $('topmenu').getElementsByTagName('li');
		for(var i = 0; i < lis.length; i++) {
			if(lis[i].className == 'navon') lis[i].className = '';
		}
		$('header_' + key).parentNode.parentNode.className = 'navon';
	}

	function toggleMenu(key, url, indexq) {
		menukey = key;
		switchheader(key);
		if(url) {
			var hrefs = $('menu_' + key).getElementsByTagName('a');
			for(var j = 0; j < hrefs.length; j++) {
				hrefs[j].className = j == indexq ? 'tabon' : '';
				if(hrefs[j].className =='tabon' ){
					var tar_url = hrefs[j].getAttribute("href");
					$('main').setAttribute("src",tar_url);
				}
			}
		}
	}
	function initCpMenus(menuContainerid) {
		var key = '', lasttabon1 = null, lasttabon2 = null, hrefs = $(menuContainerid).getElementsByTagName('a');
		for(var i = 0; i < hrefs.length; i++) {
			if(!hrefs[i].getAttribute('ajaxtarget')) hrefs[i].onclick = function() {
				if(menuContainerid != 'custommenu') {
					var lis = $(menuContainerid).getElementsByTagName('li');
					for(var k = 0; k < lis.length; k++) {
						if(lis[k].firstChild && lis[k].firstChild.className != 'menulink') {
							if(lis[k].firstChild.tagName != 'DIV') {
								lis[k].firstChild.className = '';
							} else {
								var subid = lis[k].firstChild.getAttribute('sid');
								if(subid) {
									var sublis = $(subid).getElementsByTagName('li');
									for(var ki = 0; ki < sublis.length; ki++) {
										if(sublis[ki].firstChild && sublis[ki].firstChild.className != 'menulink') {
											sublis[ki].firstChild.className = '';
										}
									}
								}
							}
						}
					}
					if(this.className == '') this.className = menuContainerid == 'leftmenu' ? 'tabon' : '';
				}
			}
		}
		return key;
	}
	var header_key = initCpMenus('leftmenu');
	toggleMenu(header_key ? header_key : 'index');
</script>
</body>
</html>